const app = getApp()
const $api = require('../../../utils/api.js').API;
Page({
    data: {
        avatar:'',
        imgUrl:app.globalData.imgUrl,
        codeUrl:'',
    },
    onLoad: function() {
        this.setData({
            avatar:wx.getStorageSync('avatarUrl')
        })
        this.getRcode();
    },
    getRcode:function(){
      if(!this.data.rcode){
          var that = this;
          var data ={'uid':wx.getStorageSync('uid')}
          $api.get('member/rcode',data).then(res => {
              //请求成功
              if(res.data.code == 1){
                that.setData({
                  codeUrl:res.data.data,
                })
              }
          }).catch(err => {
              //请求失败
              //console.log('error',err);
          })
      }
  },
    onShareAppMessage: function() {
      return {
          title: "天意美业直通车",
          imageUrl:this.data.imgUrl+this.data.codeUrl,
          path: "/pages/index/index?puid="+wx.getStorageSync('uid')
      };
    }
});